<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Xdecoder</title>

    <!-- Bootstrap core CSS -->
    <!--link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">-->
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="/static/css/dashboard.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <!--<script src="../../assets/js/ie-emulation-modes-warning.js"></script>-->

	<script language="JavaScript">
    function myrefresh()
    {
        window.location.reload();
    }
    //setTimeout('myrefresh()',2000); //指定2秒刷新一次
    </script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>

    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">Xdecoder</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
            <li><a href="#">Dashboard</a></li>
            <li><a href="#">Settings</a></li>
            <li><a href="#">Profile</a></li>
            <li><a href="#">Help</a></li>
          </ul>
          <form class="navbar-form navbar-right">
            <input type="text" class="form-control" placeholder="Search...">
          </form>
        </div>
      </div>
    </nav>

    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
          <ul class="nav nav-sidebar">
            <li class="active"><a href="/history">History<span class="sr-only">(current)</span></a></li>
          </ul>
        </div>

        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
          <form action="/search" method="get">
            <div class="row">
              <div class="col-lg-8">
              <div class="input-group">
                <input type="text" class="form-control" placeholder="Search for ..." name="input">
                <span class="input-group-btn">
                  <button class="btn btn-default" type="submit">Go!</button>
                </span >
              </div><!-- /input-group -->
              <p class="text-info"></p>
              <p class="text-info">You can use field:keyword to filter the search, field should be in(recognition, client_info), such as recognition:yesterday</p>
              </div><!-- /.col-lg-6 -->
            </div><!-- /.row -->
          </form>

          <h4 class="sub-header"> </h4>

          <div class="table-responsive">
            <table class="table table-striped">
      			<tr>
      				<th>Id</th>
      				<th>Datetime</th>
      				<th>Wav</th>
      				<th>Recognition</th>
      				<th>ClientInfo</th>
      			</tr>
      			{% for item in history %}
      				<tr>
      					<td>{{ item[0] }}</td>
      					<td>{{ item[1] }}</td>
      					<td>
                            <audio src="{{ item[2] }}" controls="controls">
                                Your browser does not support the audio element.
                            </audio>
                        </td>
      					<td>{{ item[3] }}</td>
      					<td>{{ item[4] }}</td>
      				</tr>
      			{% end %}
            </table>

            <nav>
              <ul class="pagination">
              {% if start_page > 0 %}
                  <li> <a href="/history?page={{ start_page - 1 }}&page_items={{ page_items }}" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li>
              {% else %}
                  <li class="disabled"><a href="#" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li>
              {% end %}
              {% for i in range(start_page, end_page+1) %}
                  {% if i == page %}
                      <li class="active"><a href="/history?page={{ i }}&page_items={{ page_items }}">{{ i }} <span class="sr-only">(current)</span></a></li>
                  {% else %}
                      <li ><a href="/history?page={{ i }}&page_items={{ page_items }}">{{ i }} </a></li>
                  {% end %}
              {% end %}
              {% if end_page+1 < num_pages %}
                  <li><a href="/history?page={{ end_page+1 }}&page_items={{ page_items }}" aria-label="Next"><span aria-hidden="true">&raquo;</span></a></li>
              {% else %}
                  <li class="disabled"><a href="#" aria-label="Next"><span aria-hidden="true">&raquo;</span></a></li>
              {% end %}
              </ul>
            </nav>

          </div>
        </div>
      </div>
    </div>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/bootstrap.min.js"></script>
    <!-- Just to make our placeholder images work. Don't actually copy the next line! -->
    <!--<script src="../../assets/js/vendor/holder.min.js"></script>-->
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <!--<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>-->
  </body>
</html>
